package close.kenny.shell.view
{
	import mx.controls.Alert;
	import org.puremvc.as3.multicore.interfaces.IMediator;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.patterns.mediator.Mediator;
	import close.kenny.shell.ShellFacade;
	public class ShellMediator extends Mediator implements IMediator
	{
		public static const NAME:String="ShellMediator";
		public function ShellMediator(viewComponent:Shell)
		{
			super(NAME, viewComponent);
		}
		private function get shell():Shell
		{
			return viewComponent as Shell;
		}
		override public function listNotificationInterests():Array
		{
			return [ShellFacade.LOGINSUCCESS,ShellFacade.LOGINFAULT,];
		}
		
		override public function handleNotification(note:INotification):void
		{
			switch (note.getName())
			{
				case ShellFacade.LOGINSUCCESS:
					shell.currentState="Desktop"
					sendNotification(ShellFacade.USERINI,shell);
				break;
				case ShellFacade.LOGINFAULT:
					Alert.show("用户名或者密码错误");
				break;
			}
		}
	}
}